package com.example.yls.karm;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class Karm extends AppCompatActivity {
    private ImageView ivdog;
    private Button btnNext;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_karm);
       ivdog=findViewById(R.id.imge_dog);
       btnNext=findViewById(R.id.btn_Next);
       btnNext.setOnClickListener(new View.OnClickListener() {
private int[] dogimge={R.drawable.dog1,R.drawable.dog2,R.drawable.dog3,
        R.drawable.dog3,R.drawable.dog4,R.drawable.dog5};
    private int index=0;
           @Override
           public void onClick(View view) {
               index=(index+1)%dogimge.length;
               ivdog.setImageResource(dogimge[index]);

           }
       });
    }
}
